<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
<div id="app">
    <h3>已经出库的商品</h3>
    <ul>
        <li v-for="goods in outGoodss">
            {{goods.name}}
        </li>
    </ul>
    <h3>没有出库的商品</h3>
    <ul>
        <li v-for="goods in inGoodss">
            {{goods.name}}
        </li>
    </ul>
</div>
<!--引入vue文件-->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>

    const vm = Vue.createApp({
        data(){
            return {
                goodss: [
                    {name: '洗衣机', isOut: false},
                    {name: '冰箱', isOut: true},
                    {name: '空调', isOut: false},
                    {name: '电视机', isOut: true},
                    {name: '电脑', isOut: false}
                ]
            }
        },
        computed: {
            outGoodss(){
                return this.goodss.filter(goods=>goods.isOut);
            },
            inGoodss(){
                return this.goodss.filter(goods=>!goods.isOut);
            }
        }
    }).mount('#app')

</script>

</body>
</html>
